import {ref, reactive} from 'vue'
import {useRoute} from 'vuex'
import {getCategory} from "@/api/media/category";

export default function(query) {
  const store = useRoute()
  const categoryList = ref([])
  const queryList = reactive({
    corpid: store.getters.corpinfo.corpid,
    haschildren: 0,
    page: 1,
    pagesize: 10000,
    iscache: 1
  })
  const resultQueryList = Object.assign(queryList, query)
  getCategory(resultQueryList).then(response => {
    categoryList.value = response.data.list
  })
  return {
    categoryList
  }
}
